package com.boot.utils;

import java.time.LocalDate;
import java.util.HashMap;
import java.util.Map;

public class XiaBu {

    //产生任意区间的随机数
    public static int random(int start,int end){
        int i = (int) (Math.random() * (end - start + 1)) + start;
        return i;
    }
    public static void main(String[] args) {
        Map<String,Object> data=new HashMap<String,Object>();

        data.put("gfmc","北京齐尔布莱特科技有限公司");
        data.put("nsrsbh","91110108791607588Y");
        data.put("email","928634416@qq.com");
        data.put("phone","");
        data.put("address","北京市海淀区丹棱街3号中国电子大厦B座10层1010室");
        data.put("tel","010-59857014");
        data.put("khyh","招商银行双榆树支行");
        data.put("yhzh","110906462210702");

        //data.put("gfmc","易保科技(北京)有限公司");
        //data.put("nsrsbh","91110108061255226R");
        //data.put("email","928634416@qq.com");
        //data.put("address","北京市海淀区知春路51号五层5586");
        //data.put("tel","010-62621936");
        //data.put("khyh","兴业银行北京分行西客站支行");
        //data.put("yhzh","321100100100154909");

        data.put("kplx","qy");
        data.put("tablename","BILLS_BREAK");
        data.put("sourceFlag","1");
        //base64加密串 店铺编号 8011023 8011375(门头沟) 8011373(良乡) 订单号 金额 日期
        String sign_model="8055002,%s,%s,%s";
        String price=random(50,200)+".00";
        String orderId = "H0000" + random(10, 150);
        LocalDate date = LocalDate.now().minusDays(LocalDate.now().getDayOfWeek().getValue() + 3 * 5);
        String str=String.format(sign_model,orderId,price,date);
        System.out.println(str);
        String sign=Base64Utils.encode(str.getBytes());

        data.put("r",sign);
        data.put("openid","onGjejpHLKz4nRcbOYNuz_4A7xQd=");

        String res=HttpUtils.doPost("http://fp.xiabu.com/xiabuInvoice/wxsm/wechatKp",data,"utf-8");
        System.out.println(res);

    }

}
